package com.hkfn.rfb.common.bean;

import android.content.Context;
import android.os.Environment;

import androidx.annotation.NonNull;

public class ConstData {

    public static final String PSW_KEY = "wzt";
    public static final boolean INNER = false;

    public static final int NO_NET_WHAT = -1;
    public static final String URL_ERROR_MSG = "网络请求失败";
    public static final String NET_LINKED_ERROR_MSG = "网络请求失败";


    //======================日期格式======================
    public static final String TIME_FORMAT_YYYY_MM_DD = "yyyy-MM-dd";
    public static final String TIME_FORMAT_YYYYMMDD = "yyyyMMdd";
    public static final String TIME_FORMAT_YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
    public static final String TIME_FORMAT_YYYY_MM_DD_HH_MM = "yyyy-MM-dd HH:mm";
    public static final String TIME_FORMAT_YYYYMMDDHHMMSS = "yyyyMMddHHmmss";


    /**
     * 请求列表参数
     */
    public static final String PAGEINDEX = "current";
    public static final String PAGESIZE = "size";
    public static final String PAGE_10 = "20";

    /**
     * 用户信息
     */
    public static final String USERINFO = "userInfo";
    public static final String COMPANYID = "companyId";
    public static final String USERTOKEN = "userToken";
    public static final String USERACCOUNT = "userAccount";
    public static final String USERPASSWORD = "userPassword";
    public static final String USERROLE= "userRole";
    public static final String LASTVERSION = "lastVersion";
    /**
     * 页面传递关键字
     */
    public static final String URL = "url";
    public static final String BARTYPE = "barType";
    public static final String JSONOBJECT = "jsonObject";
    /**
     * action
     */
    public static final String ACTIONMODLE = "actionModel";
    public static final String ACTIONTITLE = "actionTitle";
    public static final String ACTIONTYPE = "actionType";
    public static final String ACTIONVALUE = "actionValue";
    public static final String ACTIONPARAMS = "actionParams";
    /**
     * 页面跳转动作类型
     */
    public static final String WEB = "web";
    public static final String SQCODE = "sqCode";
    public static final String PHONE = "phone";
    public static final String PAGE_PATH = "pagePath";
    public static final String SHOWFRAG = "showFrag";
    /**
     * fragment页面类型
     */
    public static final String BAR_FLOOR = "bar_floor";
    /**
     * 充电页面标题
     */
    public static final String CHARGE_LIST = "充电仓";
    public static final String CHARGE_INFO = "充电信息";
    public static final String CHARGE_PARAMETERS = "充电参数";
    public static final String CHARGE_SINGLE_INFO = "单体信息";
    public static final String CHANGE_ERROR_INFO = "故障信息";
    /**
     * 加热控制器标题
     */
    public static final String HEAT_CONTROL_INFO = "加热控制器信息";
    public static final String HEAT_CONTROL_ALARM = "加热控制器故障信息";
    /**
     * 关于页面标题
     */
    public static final String FUNCTION_MENU = "功能菜单";
    public static final String BUS_DIAGNOSIS = "总线诊断";
    public static final String SET_PARAMETERS = "配置参数";
    public static final String WORKING_CONDITION = "工作状态";
    public static final String ALARM_TESTING = "报警测试";
    public static final String SYSTEM_RESET = "系统复位";
    public static final String ORDERLY_ELECTRICITY_CONSUMPTION = "有序用电";
    public static final String SYSTEM_SETTING = "系统设置";
    public static final String SYSTEM_INFORMATION = "系统信息";
    /**
     * RFB页面
     */
    public static final String EMS_MAIN = "首页";
    public static final String RFB_MAIN = "液流电池测试平台";

    /**
     * 跳转页面FLAG
     */
    public static final String SKIP_FLAG = "skipFlag";

    /**
     * 存储在PreferenceUtils中开通时间
     */
    public static final String OPEN_STATION_TIME = "open_station_time";
    /**
     * 存储在PreferenceUtils中本次启动时间
     */
    public static final String START_TIME = "start_time";
    /**
     * 是否重启次数
     */
    public static final String SAVE_RESTART = "saveRestart";

    /**
     * 存储在PreferenceUtils中导航栏是否隐藏
     */
    public static final String NAV_HIDE_FLAG = "nav_hide_flag";
    /**
     * 存储在PreferenceUtils中工作状态 0工作状态 1休息状态
     */
    public static final String WORKING_STATUS = "workingStatus";
    /**
     * 存储在PreferenceUtils中电池箱锁住状态
     */
    public static final String BATTERY_LOCK_STATUS = "batteryLockStatus";
    /**
     * 存储在PreferenceUtils中系统IMEI
     */
    public static final String DEVICE_IMEI = "device_imei";
    /**
     * 存储在PreferenceUtils中导航栏是否隐藏
     */
    public static final String CASE_CHARGE_INFO = "case_charge_time_info";
    /**
     * 存储在PreferenceUtils中当天是否存过累计数据
     */
    public static final String SAVE_DAY_DATA_FLAG = "save_day_data_flag";
    /**
     * 存储在PreferenceUtils中手动自动控制开关 0手动 1自动
     */
    public static final String CHANGE_BREAKER_FLAG = "change_breaker_flag";
    /**
     * 存储在PreferenceUtils中手动充放电模式
     */
    public static final String CHANGE_BREAKER_WORK_MODEL = "change_breaker_work_model";

    // 设置安装
    public static final String INSTALL_APK_FILE_NAME = "InstallApkInfo.txt";
    // 设置充电策略
    public static final String CHARGE_PARAM_FILE_NAME = "ChargeParam.txt";
    // 设置有序用电
    public static final String CHARGE_CURRENT_PARAM_FILE_NAME = "ChargeCurrentParam.txt";
    // 设置保护参数
    public static final String PROTECT_PARAM_FILE_NAME = "ProtectParam.txt";
    // 设置加热参数
    public static final String HEAT_PARAM_FILE_NAME = "HeatParam.txt";
    // 站点信息
    public static final String STATION_INFO_FILE_NAME = "StationInfo.txt";

    public static final String DIR_NAME = "/HKFN_EMS";
    /**
     * 保存错误日志到sd卡中
     */
    public static final String LOG_LOCATION = Environment.getExternalStorageDirectory().getPath() + DIR_NAME + "/logs/";
    /**
     * 保存设备信息到sd卡中
     */
    public static final String INFO_LOCATION = Environment.getExternalStorageDirectory().getPath() + DIR_NAME + "/info/";

    /**
     * 下载路径存储路径
     */
    public static String getMyAppInfoPathFile(@NonNull Context context) {
        try {
            return context.getExternalFilesDir(null).getAbsolutePath() + "/info/";
        } catch (Exception e) {
            StringBuilder sb = new StringBuilder();
            sb.append("/sdcard/Android/data/").append(context.getPackageName()).append("files")
                    .append("/info/");
            return sb.toString();
        }
    }

    /**
     * 版本更新app存储路径
     */
    public static String getMyAppDownloadPath(@NonNull Context context, String version) {
//        try {
//            return context.getExternalFilesDir("Cabinet").getAbsolutePath() + "/cabinet" + version + ".apk";
//        } catch (Exception e) {
        StringBuilder sb = new StringBuilder();
        sb.append("/sdcard/Android/data/").append(context.getPackageName())
                .append("/files/").append("EmsProject/emsProject").append(version).append(".apk");
        return sb.toString();
        // }
    }

    /**
     * 下载路径存储路径
     */
    public static String getMyAppUpdatePathFile(@NonNull Context context) {
        try {
            return context.getExternalFilesDir(null).getAbsolutePath() + "/update/";
        } catch (Exception e) {
            StringBuilder sb = new StringBuilder();
            sb.append("/sdcard/Android/data/").append(context.getPackageName()).append("files")
                    .append("/update/");
            return sb.toString();
        }
    }

    /**
     * 下载路径存储路径
     */
    public static String getMyAppDownloadPathFile(@NonNull Context context) {
        try {
            return context.getExternalFilesDir(null).getAbsolutePath() + "/downloads/";
        } catch (Exception e) {
            StringBuilder sb = new StringBuilder();
            sb.append("/sdcard/Android/data/").append(context.getPackageName()).append("/files")
                    .append("/downloads/");
            return sb.toString();
        }
    }

    /**
     * log存储路径
     */
    public static String getLogsPathFile(@NonNull Context context) {
        try {
            return context.getExternalFilesDir(null).getAbsolutePath() + "/logs/";
        } catch (Exception e) {
            StringBuilder sb = new StringBuilder();
            sb.append("/sdcard/Android/data/").append(context.getPackageName()).append("/files")
                    .append("/logs/");
            return sb.toString();
        }
    }
}
